#pragma once

#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include "iot_usbh_cdc.h"

#ifdef __cplusplus
extern "C"
{
#endif
extern int rssi, ber;

#define RNDIS_DEFAULT_CONFIG()\
    {                                \
        .task_stack_size = 1024 * 5,  \
        .task_priority = 5, \
        .task_coreid = 1, \
        .skip_init_usb_host_driver = false, \
        .auto_detect = true, \
        .auto_detect_timeout = pdMS_TO_TICKS(1000), \
    }

typedef struct {
    size_t task_stack_size;                    /*!< Stack size of the driver's task */
    unsigned task_priority;                    /*!< Priority of the driver's task */
    int task_coreid;                           /*!< Core of the driver's task, Set it to -1 to not specify the core. */
    bool skip_init_usb_host_driver;            /*!< Skip initialization of USB host driver */
    usbh_cdc_new_dev_cb_t new_dev_cb;          /*!< Callback function when a new device is connected */
    bool auto_detect;                         /*!< Auto detect RNDIS device */
    TickType_t auto_detect_timeout;           /*!< Auto detect timeout in ticks, used when auto_detect is true */
    esp_event_handler_t handler;    /*!< Modem event handler */
} rndis_config_t;

esp_err_t modem_rndis_init(rndis_config_t *config);
esp_err_t modem_rndis_get_signal_quality(int *rssi, int *ber);

#ifdef __cplusplus
}
#endif